package com.llh.uua.conf

import org.ktorm.database.Database
import org.ktorm.jackson.KtormModule
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import javax.sql.DataSource
/**
 *
 *
 * Created At 2021/3/17 21:25
 * @author llh
 */
@Configuration
class KtormConfiguration {

    @Autowired
    private lateinit var dataSource: DataSource


    @Bean
    fun database(): Database {
        return Database.connectWithSpringSupport(dataSource)
    }


    @Bean
    fun ktormModule(): com.fasterxml.jackson.databind.Module {
        return KtormModule()
    }
}